/*
 * @Author: your name
 * @Date: 2021-07-20 10:01:17
 * @LastEditTime: 2022-05-24 21:20:54
 * @LastEditors: hq
 * @Description: In User Settings Edit
 * @FilePath: \my-project\src\store\index.js
 */
import Vue from "vue";
import Vuex from "vuex";

Vue.use(Vuex);

const state = {
    // 应用启动时，username 置为空
    menuIndex: 0
};
const mutations = {
    // mutation 的第一个参数是当前的 state
    // 你可以在函数里修改 state,第二个参数传过来的参数
    saveMenu(state, data) {
        state.menuIndex = data;
    },
};
const actions = {};

//2.创建对象
const store = new Vuex.Store({
    state,
    mutations,
    actions,
});

export default store;